Exploring the Restaurant scenario in the Neighborhood of Jaipur

theme.jpg

Applied Data Science capstone project for IBM/Coursera

Introduction

Jaipur is the capital and the largest city of the Indian state of Rajasthan. As of 2011, the city had a population of 3.1 million, making it the tenth most populous city in the country. Jaipur is also known as the Pink City, due to the dominant colour scheme of its buildings.] It is located 268 km (167 miles) from the national capital New Delhi. Jaipur is a popular tourist destination in India and forms a part of the west Golden Triangle tourist circuit along with Delhi and Agra (240 km, 149 mi). It also serves as a gateway to other tourist destinations in Rajasthan such as Jodhpur (348 km, 216 mi), Jaisalmer (571 km, 355 mi), Udaipur (421 km, 262 mi), Kota (252 km, 156 mi) and Mount Abu (520 km, 323 mi). Jaipur is located 616 km from Shimla.

Jaipur.jpg

JAI.jpg

The aim of the project is to identify venues in Jaipur, India based on their rating and average prices. In this notebook, we will identify various venues in the city of Jaipur, India, using Foursquare API and Zomato API, to help visitors select the restaurants that suit them the best.

Whenever a user is visiting a city they start looking for places to visit during their stay. They primarily look for places based on the venue ratings across all venues and the average prices such that the locations fits in their budget.

Here, we'll identify places that are fit for various individuals based on the information collected from the two APIs and Data Science. Once we have the plot with the venues, any company can launch an application using the same data and suggest users such information.

Target Audience

The target audience for such a project is twofold. Firstly, any person who is visiting Jaipur, The Pink City of Rajasthan.

India can use the plots and maps from this project to quickly select places that suit their budget and rating preferences. Secondly, an entrepreneur who want to open new restaurants in Jaipur can use this information to create a website or a mobile application, which is updated on a regular basis, to allow individuals to the city or even expand same functionality to other places. We will use the data science tools and techniques to understand or weigh in the pros and cons of a location. We provide an analysis for the stakeholders to take a data driven decision to choose the best category/location/price range in the city about most promising and viable option.

Jaipur is the capital and the largest city of the Indian state of Rajasthan. As of 2011, the city had a population of 3.1 million, making it the tenth most populous city in the country. Jaipur is also known as the Pink City, due to the dominant colour scheme of its buildings.] It is located 268 km (167 miles) from the national capital New Delhi.

In [1]:
import pandas as pd 
import numpy as np
import requests
import matplotlib.pyplot as plt
import json
from pandas.io.json import json_normalize

!pip install geopy
from geopy.geocoders import Nominatim

import matplotlib.cm as cm
import matplotlib.colors as colors

from sklearn.cluster import KMeans
!pip install folium
import folium
from geopy.geocoders import Nominatim

print('libraries imported')
Collecting geopy
  Downloading https://files.pythonhosted.org/packages/ab/97/25def417bf5db4cc6b89b47a56961b893d4ee4fec0c335f5b9476a8ff153/geopy-1.22.0-py2.py3-none-any.whl (113kB)
     |████████████████████████████████| 122kB 3.3MB/s eta 0:00:01
Collecting geographiclib<2,>=1.49 (from geopy)
  Downloading https://files.pythonhosted.org/packages/8b/62/26ec95a98ba64299163199e95ad1b0e34ad3f4e176e221c40245f211e425/geographiclib-1.50-py3-none-any.whl
Installing collected packages: geographiclib, geopy
Successfully installed geographiclib-1.50 geopy-1.22.0
Requirement already satisfied: folium in /home/jupyterlab/conda/envs/python/lib/python3.6/site-packages (0.5.0)
Requirement already satisfied: requests in /home/jupyterlab/conda/envs/python/lib/python3.6/site-packages (from folium) (2.23.0)
Requirement already satisfied: six in /home/jupyterlab/conda/envs/python/lib/python3.6/site-packages (from folium) (1.14.0)
Requirement already satisfied: branca in /home/jupyterlab/conda/envs/python/lib/python3.6/site-packages (from folium) (0.4.1)
Requirement already satisfied: jinja2 in /home/jupyterlab/conda/envs/python/lib/python3.6/site-packages (from folium) (2.11.2)
Requirement already satisfied: certifi>=2017.4.17 in /home/jupyterlab/conda/envs/python/lib/python3.6/site-packages (from requests->folium) (2020.4.5.1)
Requirement already satisfied: chardet<4,>=3.0.2 in /home/jupyterlab/conda/envs/python/lib/python3.6/site-packages (from requests->folium) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /home/jupyterlab/conda/envs/python/lib/python3.6/site-packages (from requests->folium) (1.25.9)
Requirement already satisfied: idna<3,>=2.5 in /home/jupyterlab/conda/envs/python/lib/python3.6/site-packages (from requests->folium) (2.9)
Requirement already satisfied: MarkupSafe>=0.23 in /home/jupyterlab/conda/envs/python/lib/python3.6/site-packages (from jinja2->folium) (1.1.1)
libraries imported
In [2]:
address='Jaipur'
geolocator=Nominatim(user_agent='japur_explorer')
In [3]:
location=geolocator.geocode(address,timeout=None)
print(location)
latitude=location.latitude
longitude=location.longitude
print('{} is latitude. {} is longitude'.format(latitude,longitude))
/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/ipykernel_launcher.py:1: DeprecationWarning: `timeout=None` has been passed to a geocoder call. Using default geocoder timeout. In geopy 2.0 the behavior will be different: None will mean "no timeout" instead of "default geocoder timeout". Pass geopy.geocoders.base.DEFAULT_SENTINEL instead of None to get rid of this warning.
  """Entry point for launching an IPython kernel.
Jaipur, Jaipur Tehsil, Jaipur, Rajasthan, 302001, India
26.916194 is latitude. 75.820349 is longitude
In [4]:
CLIENT_ID = 'RQ5VU21QNUA5ANUCLIGEMSXGHJ43XSGUP3PCXHB4H5KIB1NF' # your Foursquare ID
CLIENT_SECRET = 'SAAMYVHGNGQCTB3QWYDPSLMVJJD1FSIGYYJSMTLUR2EEQK1W' # your Foursquare Secret
VERSION = '20100602'
print('Your credentails:')
print('CLIENT_ID: ' + CLIENT_ID)
print('CLIENT_SECRET:' + CLIENT_SECRET)
Your credentails:
CLIENT_ID: RQ5VU21QNUA5ANUCLIGEMSXGHJ43XSGUP3PCXHB4H5KIB1NF
CLIENT_SECRET:SAAMYVHGNGQCTB3QWYDPSLMVJJD1FSIGYYJSMTLUR2EEQK1W
In [5]:
radius=20000
LIMIT=150

From Foursquare API (https://api.foursquare.com/v2/venues/) , retrieved the following for each venue:

  • Name: The name of the venue.
  • Category: The category type as defined by the API.
  • Latitude: The latitude value of the venue.
  • Longitude: The longitude value of the venue.
In [6]:
fsq_url='https://api.foursquare.com/v2/venues/explore?&client_id=RQ5VU21QNUA5ANUCLIGEMSXGHJ43XSGUP3PCXHB4H5KIB1NF&client_secret=SAAMYVHGNGQCTB3QWYDPSLMVJJD1FSIGYYJSMTLUR2EEQK1W&v=20200602&ll=26.916194,75.820349'.format(
    CLIENT_ID, 
    CLIENT_SECRET, 
    VERSION, 
    latitude,
    longitude, 
    radius, 
    LIMIT)
In [7]:
fsq_request=requests.get(fsq_url).json()
In [8]:
fsq_venues=json_normalize(fsq_request['response']['groups'][0]['items'])
fsq_venues.head()
/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/ipykernel_launcher.py:1: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead
  """Entry point for launching an IPython kernel.
Out[8]:
referralId reasons.count reasons.items venue.id venue.name venue.location.lat venue.location.lng venue.location.labeledLatLngs venue.location.distance venue.location.cc ... venue.location.state venue.location.country venue.location.formattedAddress venue.categories venue.photos.count venue.photos.groups venue.location.address venue.location.crossStreet venue.location.postalCode venue.location.neighborhood
0 e-0-50cde2b4e4b0881a7ce5c480-0 0 [{'summary': 'This spot is popular', 'type': '... 50cde2b4e4b0881a7ce5c480 Tapri - The Tea House & Jizo 26.905663 75.811182 [{'label': 'display', 'lat': 26.90566346213392... 1483 IN ... Rājasthān India [Jaipur, Rājasthān, India] [{'id': '4bf58dd8d48988d1dc931735', 'name': 'T... 0 [] NaN NaN NaN NaN
1 e-0-4c7940de20bb199cd3ee0d29-1 0 [{'summary': 'This spot is popular', 'type': '... 4c7940de20bb199cd3ee0d29 Raj Mandir Theatre 26.915537 75.809862 [{'label': 'display', 'lat': 26.91553657647599... 1043 IN ... Rājasthān India [Panch Batti Circle, Jaipur, Rājasthān, India] [{'id': '4bf58dd8d48988d17e941735', 'name': 'I... 0 [] Panch Batti Circle NaN NaN NaN
2 e-0-4bc7875893bdeee12e7c37ae-2 0 [{'summary': 'This spot is popular', 'type': '... 4bc7875893bdeee12e7c37ae Rambagh Palace Hotel 26.897931 75.808390 [{'label': 'display', 'lat': 26.89793120613395... 2354 IN ... Rājasthān India [Bhawani Singh Road, Jaipur, Rājasthān, India] [{'id': '4bf58dd8d48988d1fa931735', 'name': 'H... 0 [] Bhawani Singh Road NaN NaN NaN
3 e-0-54fc3d16498edf0d9bf04cce-3 0 [{'summary': 'This spot is popular', 'type': '... 54fc3d16498edf0d9bf04cce Moustache Hostel 26.919589 75.797884 [{'label': 'display', 'lat': 26.91958916498067... 2261 IN ... Rājasthān India [7, Park House Scheme near Ganpati Plaza (MI R... [{'id': '4bf58dd8d48988d1ee931735', 'name': 'H... 0 [] 7, Park House Scheme near Ganpati Plaza MI Road, Sindhi Camp 302001 NaN
4 e-0-4bb594102f70c9b668628430-4 0 [{'summary': 'This spot is popular', 'type': '... 4bb594102f70c9b668628430 Jantar Mantar 26.924867 75.824342 [{'label': 'display', 'lat': 26.92486697724884... 1043 IN ... Rājasthān India [Near City Palace (Tulsi Marg), Jaipur 302002,... [{'id': '4deefb944765f83613cdba6e', 'name': 'H... 0 [] Near City Palace Tulsi Marg 302002 NaN

5 rows × 21 columns

In [9]:
def get_cat_type(row):
    categories_list = row['venue.categories']
    if len(categories_list) == 0:
        return None
    else:
        return categories_list[0]['name']
In [10]:
column_names=['venue.id','venue.location.lat', 'venue.location.lng','venue.name','venue.categories']
fsq_ven_df=fsq_venues[column_names]
fsq_ven_df['venue.categories']=fsq_ven_df.apply(get_cat_type,axis=1)
fsq_ven_df.head()
/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/ipykernel_launcher.py:3: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  This is separate from the ipykernel package so we can avoid doing imports until
Out[10]:
venue.id venue.location.lat venue.location.lng venue.name venue.categories
0 50cde2b4e4b0881a7ce5c480 26.905663 75.811182 Tapri - The Tea House & Jizo Tea Room
1 4c7940de20bb199cd3ee0d29 26.915537 75.809862 Raj Mandir Theatre Indie Movie Theater
2 4bc7875893bdeee12e7c37ae 26.897931 75.808390 Rambagh Palace Hotel Hotel
3 54fc3d16498edf0d9bf04cce 26.919589 75.797884 Moustache Hostel Hostel
4 4bb594102f70c9b668628430 26.924867 75.824342 Jantar Mantar Historic Site
In [11]:
jaipur_map=folium.Map(location=[latitude,longitude],zoom_start=14)
jaipur_map
Out[11]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [12]:
for lat,long,name in zip(fsq_ven_df['venue.location.lat'],fsq_ven_df['venue.location.lng'],fsq_ven_df['venue.name']):
    label = '{}'.format(name)
    label = folium.Popup(label, parse_html=True)
    folium.CircleMarker(
     [lat, long],
        radius=5,
        popup=label,
        color='Yellow',
        fill=True,
        fill_color='#34867b',
        fill_opacity=0.7,
        parse_html=True).add_to(jaipur_map)
jaipur_map
Out[12]:
Make this Notebook Trusted to load map: File -> Trust Notebook

From Zomato API (https://developers.zomato.com/api), Retrieved the following for each venue:

  • Venue Name: The name of the venue.
  • Address: The complete address of the venue.
  • Rating: The ratings as provided by many users.
  • Price range: The price range the venue belongs to as defined by Zomato.
  • Price for two: The average cost for two people dining at the place.
  • Latitude: The latitude value of the venue.
  • Longitude: The longitude value of the venue.
  • Cuisines: Cusines of the venue
In [13]:
import requests

headers = {
    'Accept': 'application/json',
    'user-key': '6caad1604d0957334c32550f321d2e5b',
}

venues_information = []
for i,j,k in zip(fsq_ven_df['venue.name'],fsq_ven_df['venue.location.lat'],fsq_ven_df['venue.location.lng']):
    
    url=('https://developers.zomato.com/api/v2.1/search?q={}' + 
          '&start=0&lat={}&lon={}&radius=3000').format(i,j,k)
    response = requests.get(url, headers=headers).json()
    if len(response['restaurants'])>0:
        for i in range(len(response['restaurants'])):
            zom_venue=[]
            zom_venue.append(response['restaurants'][i]['restaurant']['name'])
            zom_venue.append(response['restaurants'][i]['restaurant']['location']['latitude'])
            zom_venue.append(response['restaurants'][i]['restaurant']['location']['longitude'])
            zom_venue.append(response['restaurants'][i]['restaurant']['average_cost_for_two'])
            zom_venue.append(response['restaurants'][i]['restaurant']['price_range'])
            zom_venue.append(response['restaurants'][i]['restaurant']['user_rating']['aggregate_rating'])
            zom_venue.append(response['restaurants'][i]['restaurant']['location']['address'])
            zom_venue.append(response['restaurants'][i]['restaurant']['cuisines'])
            venues_information.append(zom_venue)
           
    else:
        venues_information.append(np.zeros(6))
In [14]:
zomato_venues = pd.DataFrame(venues_information, 
                                 columns = ['venue', 'latitude', 
                                            'longitude', 'price_for_two', 
                                             'price_range', 'rating', 'address','cuisines'])
zomato_venues.head()
Out[14]:
venue latitude longitude price_for_two price_range rating address cuisines
0 Tapri Central 26.8913840424 75.8036034554 800.0 2.0 4.6 B4 E, 3rd Floor, Surana Jewellers, Opposite Ce... Cafe, Fast Food, Street Food
1 Tapri Pratham 26.8914007876 75.8036768809 800.0 2.0 4.4 43, Everest Colony, Near Punjab National Bank ... Cafe, Fast Food, Street Food, Beverages
2 Tapri Ashram 26.8411881683 75.7960641012 800.0 2.0 4.4 Shopping Arcade, Jaipur Marriott Hotel, Ashram... Cafe, Fast Food, Street Food, Beverages
3 The Yellow House - The Robot Restaurant 26.9152631473 75.8097038046 700.0 2.0 3.6 Silver Square Mall, Near Rajmandir Cinema, C S... North Indian, Chinese, Italian, Mexican
4 Tea Tradition 26.9113571934 75.8024071902 450.0 1.0 3.8 D 29-A, Chandra Niwas, Subhash Marg, C Scheme,... Cafe, Fast Food
In [15]:
zomato_venues['latitude']=zomato_venues['latitude'].astype(float)
zomato_venues['longitude']=zomato_venues['longitude'].astype(float)
In [16]:
jaipur_map=folium.Map(location=[latitude,longitude],zoom_start=14)
jaipur_map
Out[16]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [17]:
for lat,long,name in zip(zomato_venues['latitude'],zomato_venues['longitude'],zomato_venues['venue']):
    label = '{}'.format(name)
    label = folium.Popup(label, parse_html=True)
    folium.CircleMarker(
     [lat, long],
        radius=5,
        popup=label,
        color='Yellow',
        fill=True,
        fill_color='#36167b',
        fill_opacity=0.7,
        parse_html=True).add_to(jaipur_map) 
    
    jaipur_map

Data cleaning

Extracted Restaurant venues resulted in 496 venues. We have discovered from the data collected that there are many duplicate venues and venues from other cities. We have dropped the duplicates and filtered out the restaurants by the city name ‘Jaipur’ from the address. Final dataset has 284 restaurants from the city Jaipur without any redundant data.

In [18]:
print('Total Venues:',zomato_venues.shape[0])
jaipur_zom=zomato_venues[zomato_venues['address'].str.contains('Jaipur')==True]
print('Total Venues available in Jaipur:',jaipur_zom.shape[0])
jaipur_zom.drop_duplicates(subset='venue',keep='first',inplace=True)
print('Total Venues in Jaipur after dropping duplicates:',jaipur_zom.shape[0])
Total Venues: 496
Total Venues available in Jaipur: 494
Total Venues in Jaipur after dropping duplicates: 284
/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/ipykernel_launcher.py:4: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  after removing the cwd from sys.path.
In [19]:
jaipur_zom['rating']=jaipur_zom['rating'].astype(float)
jaipur_zom['venue']=jaipur_zom['venue'].astype(str)
jaipur_zom['latitude']=jaipur_zom['latitude'].astype(float)
jaipur_zom['longitude']=jaipur_zom['longitude'].astype(float)
jaipur_zom.head()
/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/ipykernel_launcher.py:1: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  """Entry point for launching an IPython kernel.
/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/ipykernel_launcher.py:2: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  
/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/ipykernel_launcher.py:3: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  This is separate from the ipykernel package so we can avoid doing imports until
/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/ipykernel_launcher.py:4: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  after removing the cwd from sys.path.
Out[19]:
venue latitude longitude price_for_two price_range rating address cuisines
0 Tapri Central 26.891384 75.803603 800.0 2.0 4.6 B4 E, 3rd Floor, Surana Jewellers, Opposite Ce... Cafe, Fast Food, Street Food
1 Tapri Pratham 26.891401 75.803677 800.0 2.0 4.4 43, Everest Colony, Near Punjab National Bank ... Cafe, Fast Food, Street Food, Beverages
2 Tapri Ashram 26.841188 75.796064 800.0 2.0 4.4 Shopping Arcade, Jaipur Marriott Hotel, Ashram... Cafe, Fast Food, Street Food, Beverages
3 The Yellow House - The Robot Restaurant 26.915263 75.809704 700.0 2.0 3.6 Silver Square Mall, Near Rajmandir Cinema, C S... North Indian, Chinese, Italian, Mexican
4 Tea Tradition 26.911357 75.802407 450.0 1.0 3.8 D 29-A, Chandra Niwas, Subhash Marg, C Scheme,... Cafe, Fast Food

Lets define the central location in the city and calculate distances for each of the venues

In [20]:
#Central location of Jaipur
Lat_central=26.9124
Long_central=75.7873
folium.Map(location=[Lat_central,Long_central])
from geopy.distance import geodesic 

def get_distance(lat,long):
    grt = (Lat_central,Long_central) 
    curr = (lat,long) 
    return geodesic(grt,curr).km
distance_list=[]
for i,j in zip(jaipur_zom['latitude'], jaipur_zom['longitude']):
    distance_list.append(get_distance(i,j))
    
jaipur_zom['distance']=distance_list
jaipur_zom.head()
jaipur_zom['distance']=jaipur_zom['distance'].round(2)
/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/ipykernel_launcher.py:15: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  from ipykernel import kernelapp as app
/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/ipykernel_launcher.py:17: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy

Methodology

In this project we will try to propose various profiles of restaurants around a defined central location, based on the ratings, price range and distance from the central location of the City. .We have selected a central location i.e NTR circle as the central location.

First we get all the locations from foursquare api, than get all the restaurants with user ratings, passing the venues of four square api as an input after that calculate distance from the defined central location to each of the restaurants, clustering based on ratings, distance,price range within 3 kms range from the central location for profiling the restaurants.

Exploratory Data Analysis

Rating

We will explore the data based on the rating.

In [21]:
distribution_rating=jaipur_zom['rating'].value_counts().sort_index()
color=cm.rainbow((np.linspace(0,1,12)))
plt.figure(figsize = (30, 12))
plt.bar(distribution_rating.index,distribution_rating.values,color=color)
plt.xlabel("Rating", fontsize = 25)
plt.ylabel("Count", fontsize = 25)
plt.title("Count of venues with given rating", fontsize = 30)
Out[21]:
Text(0.5, 1.0, 'Count of venues with given rating')

From the above plots we can understand that the ratings of the restaurants are highly ranging from 2.5 to 5. About 15 restaurants has the rating '0'.Lets explore the subset of the dataset which has poor rating of 0.

In [22]:
sub_jaipur=jaipur_zom[(jaipur_zom['rating']==0) & (jaipur_zom['distance']<=2000)]
sub_jaipur
cui=sub_jaipur['cuisines'].value_counts().sort_index()
color=cm.rainbow((np.linspace(0,1,12)))
plt.figure(figsize = (30, 12))
plt.bar(cui.index,cui.values,color=color)
plt.xticks(rotation='vertical',fontsize=26)
plt.xlabel("cuisines", fontsize = 25)
plt.ylabel("Count", fontsize = 25)
plt.title("Count of venues with given cuisines", fontsize = 30)
plt.bar
Out[22]:
<function matplotlib.pyplot.bar(x, height, width=0.8, bottom=None, *, align='center', data=None, **kwargs)>
In [23]:
price_range=jaipur_zom['price_range'].value_counts().sort_index()
plt.figure(figsize = (30, 12))
plt.bar(price_range.index,price_range.values)

plt.xlabel("Price Range", fontsize = 25)
plt.ylabel("Count", fontsize = 25)
plt.title("Count of venues with given Price Range", fontsize = 30)
Out[23]:
Text(0.5, 1.0, 'Count of venues with given Price Range')

From the above plot we can undestand that restaurants providing more or less same kind of cuisines have 0 rating.We can't assess which cuisine/category in particular has poor rating from the above plot.

Price range for the distribution is pocket friendly in the city of Jaipur. Zomato Price_range explains cost range from 1 to 4(1 being the pocket friendly to 4 being expensive)

In [24]:
average_prices = jaipur_zom['price_for_two'].value_counts().sort_index()
plt.figure(figsize = (20, 12))
plt.scatter(average_prices.index, 
            average_prices.values, 
            s = average_prices.index*10, 
            c = cm.rainbow(np.linspace(0, 1, len(average_prices.index))))
plt.xlabel("Price per person", fontsize = 13)
plt.ylabel("Venue count", fontsize = 13)
plt.title("Count of venues with given average price", fontsize = 13)
Out[24]:
Text(0.5, 1.0, 'Count of venues with given average price')
In [25]:
final_ven=jaipur_zom[(jaipur_zom['distance']<=2000) &(jaipur_zom['rating']!=0) & (jaipur_zom['price_for_two']!=0)]
final_ven.shape
Out[25]:
(277, 9)
In [26]:
final_ven=final_ven.drop(['venue','address','cuisines'],1)
final_ven.head()
Out[26]:
latitude longitude price_for_two price_range rating distance
0 26.891384 75.803603 800.0 2.0 4.6 2.84
1 26.891401 75.803677 800.0 2.0 4.4 2.84
2 26.841188 75.796064 800.0 2.0 4.4 7.94
3 26.915263 75.809704 700.0 2.0 3.6 2.25
4 26.911357 75.802407 450.0 1.0 3.8 1.51
In [27]:
wcss = []
for i in range(1, 11):
    kmeans = KMeans(n_clusters=i, max_iter=300, n_init=10, random_state=0)
    kmeans.fit(final_ven)
    wcss.append(kmeans.inertia_)
plt.plot(range(1, 11), wcss)
plt.title('Elbow Method')
plt.xlabel('Number of clusters')
plt.ylabel('WCSS')
plt.show()
In [28]:
#cluster the areas based on the  various features of restaurants
from sklearn.cluster import KMeans

NO_OF_CLUSTERS = 4

clustering = final_ven
kMeans = KMeans(n_clusters = NO_OF_CLUSTERS, random_state = 0).fit(clustering)
In [29]:
kMeans.labels_
Out[29]:
array([0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
       0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 3, 2, 2, 2, 2, 0, 3, 3, 1, 3, 1, 0,
       1, 0, 1, 1, 0, 0, 3, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1,
       1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
       0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 1,
       1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1,
       3, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
       1, 0, 0, 1, 1, 1, 3, 3, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 2, 3, 2, 2, 2, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0,
       1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], dtype=int32)
In [30]:
clustered_df=jaipur_zom[(jaipur_zom['distance']<=2000) &(jaipur_zom['rating']!=0)& (jaipur_zom['price_for_two']!=0)]
In [31]:
clustered_df.insert(0, 'cluster_labels', kMeans.labels_)
clustered_df.head()
Out[31]:
cluster_labels venue latitude longitude price_for_two price_range rating address cuisines distance
0 0 Tapri Central 26.891384 75.803603 800.0 2.0 4.6 B4 E, 3rd Floor, Surana Jewellers, Opposite Ce... Cafe, Fast Food, Street Food 2.84
1 0 Tapri Pratham 26.891401 75.803677 800.0 2.0 4.4 43, Everest Colony, Near Punjab National Bank ... Cafe, Fast Food, Street Food, Beverages 2.84
2 0 Tapri Ashram 26.841188 75.796064 800.0 2.0 4.4 Shopping Arcade, Jaipur Marriott Hotel, Ashram... Cafe, Fast Food, Street Food, Beverages 7.94
3 0 The Yellow House - The Robot Restaurant 26.915263 75.809704 700.0 2.0 3.6 Silver Square Mall, Near Rajmandir Cinema, C S... North Indian, Chinese, Italian, Mexican 2.25
4 0 Tea Tradition 26.911357 75.802407 450.0 1.0 3.8 D 29-A, Chandra Niwas, Subhash Marg, C Scheme,... Cafe, Fast Food 1.51
In [32]:
cluster_0=clustered_df[clustered_df['cluster_labels']==0]
print('Mean distance of a distance from central location of cluster 0: ',clustered_df[clustered_df['cluster_labels']==0]['distance'].mean())
print('Mean rating of cluster 0: ',clustered_df[clustered_df['cluster_labels']==0]['rating'].mean())
print('Mean price rate for an individual of cluster 0: ',(clustered_df[clustered_df['cluster_labels']==0]['price_for_two']/2).mean())
print('There are {} restaurants in cluster 0 '.format(clustered_df[clustered_df['cluster_labels']==0]['rating'].shape[0]))
print('{} % of restaurants are in cluster 0 '.format(round((cluster_0.shape[0]/clustered_df.shape[0])*100,2)))
Mean distance of a distance from central location of cluster 0:  3.719904306220096
Mean rating of cluster 0:  3.817224880382775
Mean price rate for an individual of cluster 0:  226.79425837320574
There are 209 restaurants in cluster 0 
75.45 % of restaurants are in cluster 0 
In [33]:
cui=cluster_0['cuisines'].value_counts().sort_index()
color=cm.rainbow((np.linspace(0,1,12)))
plt.figure(figsize = (30, 12))
plt.bar(cui.index,cui.values,color=color)
plt.xticks(rotation='vertical',fontsize=20)
plt.xlabel("cuisines", fontsize = 25)
plt.ylabel("Count", fontsize = 25)
plt.title("Count of venues with given cuisines", fontsize = 30)
Out[33]:
Text(0.5, 1.0, 'Count of venues with given cuisines')
In [34]:
cluster_1=clustered_df[clustered_df['cluster_labels']==1]
print('Mean distance of a distance from central location of cluster 1: ',clustered_df[clustered_df['cluster_labels']==1]['distance'].mean())
print('Mean rating of cluster 1: ',clustered_df[clustered_df['cluster_labels']==1]['rating'].mean())
print('Mean price rate for an individual of cluster 1: ',(clustered_df[clustered_df['cluster_labels']==1]['price_for_two']/2).mean())
print('There are {} restaurants in cluster 1 '.format(clustered_df[clustered_df['cluster_labels']==1]['rating'].shape[0]))
print('{} % of restaurants are in cluster 1 '.format(round((cluster_1.shape[0]/clustered_df.shape[0])*100,2)))
Mean distance of a distance from central location of cluster 1:  2.469787234042553
Mean rating of cluster 1:  3.8999999999999995
Mean price rate for an individual of cluster 1:  702.6595744680851
There are 47 restaurants in cluster 1 
16.97 % of restaurants are in cluster 1 
In [35]:
cui=cluster_1['cuisines'].value_counts().sort_index()
color=cm.rainbow((np.linspace(0,1,12)))
plt.figure(figsize = (30, 12))
plt.bar(cui.index,cui.values,color=color)
plt.xticks(rotation='vertical',fontsize=20)
plt.xlabel("cuisines", fontsize = 25)
plt.ylabel("Count", fontsize = 25)
plt.title("Count of venues with given cuisines", fontsize = 30)
Out[35]:
Text(0.5, 1.0, 'Count of venues with given cuisines')
In [36]:
cluster_1
Out[36]:
cluster_labels venue latitude longitude price_for_two price_range rating address cuisines distance
7 1 On The House 26.905337 75.794570 1500.0 3.0 4.4 E 145, Ramesh Marg, Behind Talwalkars, C Schem... Italian, Continental, Mexican, Cafe 1.06
9 1 Corner House 26.907390 75.795520 1200.0 3.0 4.0 F 31, Azad Marg, Ashok Nagar, C Scheme, Jaipur North Indian, Chinese, Italian, Beverages, Ice... 0.99
21 1 Thali and More 26.910818 75.805427 1100.0 3.0 4.5 C-46 B, Sarojini Marg, Above Punjab National B... North Indian, South Indian, Chinese, Fast Food 1.81
29 1 Laxmi Mishthan Bhandar 26.896717 75.815396 1000.0 3.0 3.3 A/65, JLN Marg, Near Soni Hospital, Raja Park,... North Indian, Mithai, Rajasthani, South Indian... 3.29
48 1 La Palma Cafe and Lounge Bar 26.914026 75.804732 1400.0 3.0 3.9 The Hotel Garden View, Subhash Marg, Near Ahin... Italian, European, Continental 1.74
50 1 Jaipur Pavilion - ITC Rajputana Hotel 26.918846 75.791836 1800.0 3.0 4.1 ITC Rajputana Hotel, Palace Road, Gopalbari, J... South Indian, North Indian, Rajasthani, Contin... 0.84
52 1 Sammy Singh's Rooftop 26.914005 75.804734 1700.0 3.0 3.7 Hotel Garden View, Subhash Marg, C Scheme, Jaipur North Indian, Chinese, Fast Food, Italian 1.74
54 1 Rangreza 26.921679 75.794560 1200.0 3.0 4.0 Hotel Nirbana Palace, Main D Villa Building, K... North Indian, Mexican, Italian, Chinese 1.26
55 1 Bartoss Bar & Lounge 26.920704 75.789163 1600.0 3.0 3.8 Hotel Chitra Palace, Opposite Jaipur Junction,... North Indian, Italian, Continental 0.94
59 1 Bar Palladio Jaipur 26.898860 75.814172 1800.0 3.0 4.0 Hotel Narain Niwas, Kanota Bagh, Narayan Singh... Italian, Finger Food 3.06
68 1 Shikaar Bagh 26.898863 75.814160 2000.0 4.0 4.0 Hotel Narain Niwas, Kanota Bagh, Narayan Singh... Continental, Italian, North Indian, Rajasthani 3.06
70 1 Mohan Bagh - Hotel Narain Niwas 26.898849 75.814160 1500.0 3.0 2.6 Hotel Narain Niwas, Kanota Bagh, Narayan Singh... North Indian, Continental, Rajasthani 3.06
73 1 The Dining Hall - Hotel Narain Niwas 26.898868 75.814157 1500.0 3.0 2.7 Hotel Narain Niwas, Kanota Bagh, Narayan Singh... North Indian, Continental, Rajasthani 3.06
76 1 Gulabi Nagari 26.929396 75.788572 1400.0 3.0 4.3 C-13, Shiv Niwas, Sawai Jai Singh Road, Bani P... North Indian, Chinese, Beverages 1.89
89 1 Dasaprakash 26.916413 75.808080 1000.0 3.0 4.3 5, Kamal Mansion, Opposite Tanishq Jewellery, ... South Indian 2.11
106 1 Kalyan Rooftop And Indoor Restaurant 26.916201 75.795812 1200.0 3.0 3.4 59, Hathroi Fort, Ajmer Road, Gopalbari, Jaipur North Indian, South Indian, Italian, Chinese, ... 0.94
109 1 Social Vibes 26.915559 75.808909 1600.0 3.0 4.3 6th Floor, Mall 21, Bhagwandas Road, Opposite ... North Indian, Continental, Chinese 2.17
110 1 Retreat 26.915379 75.806339 1400.0 3.0 4.2 C 94, 8th Floor, Fortune Heights, Subhash Marg... North Indian, Continental, Mexican, Italian, C... 1.92
113 1 Jaipur Darbar - The Rooftop Lounge 26.897583 75.825108 1500.0 3.0 3.6 11/1, Govind Marg, Raja Park, Jaipur North Indian, Chinese, Italian 4.10
114 1 LOL 26.913243 75.802926 1200.0 3.0 3.4 8th Floor, Ambition Tower, Agrasen Circle, C S... Italian, North Indian, Chinese, Mexican 1.55
116 1 Kloud - Royal Orchid Central 26.924596 75.793444 1800.0 3.0 4.4 Royal Orchid Central, A-26, A/2, Level 9, Jais... North Indian, Chinese, Italian, Asian 1.48
117 1 Revolving Restaurant 26.917792 75.799704 1400.0 3.0 2.6 Hotel Om Tower, Church Road, MI Road, Jaipur North Indian, Chinese, Rajasthani 1.37
118 1 Govindam Retreat 26.928920 75.825540 1000.0 3.0 4.2 Kanwar Nagar, Near Govind Devji Temple, Pink C... North Indian, South Indian, Rajasthani, Fast Food 4.22
120 1 Skyfall By Replay 26.892302 75.806870 1500.0 3.0 4.3 SB 57, 5th Floor, Ridhi Tower, Opposite SMS St... North Indian, Chinese, Italian 2.96
147 1 Decked Up By Garden Cafe 26.913624 75.752904 1200.0 3.0 4.1 320, Queens Road, Opposite Jharkhand Mahadev T... Cafe, Fast Food, North Indian, South Indian, I... 3.42
168 1 The TownHouse 26.915862 75.809765 1400.0 3.0 3.8 Golcha Point, Panch Batti, MI Road, Jaipur North Indian, Italian, Mexican, Chinese, Leban... 2.26
174 1 Masala Ministry 26.911828 75.797307 1100.0 3.0 4.1 Man Upasna Mall, Chomu House, C Scheme, Jaipur North Indian, Chinese, Fast Food, Street Food,... 1.00
175 1 The Eclectica 26.892119 75.769187 1250.0 3.0 4.3 New Sanganer Road, Opposite Metro Pillar-100, ... Cafe, North Indian, Italian, Continental, Chin... 2.88
201 1 Coffee Break 26.909180 75.738471 1100.0 3.0 4.1 Shop 9, Plot 112, Jagdamba Colony, Nursery Cir... Cafe, Fast Food, Beverages 4.86
213 1 Home Café by Mr Beans 26.905040 75.794050 1000.0 3.0 4.2 E 141 A, Sardar Patel Marg, C Scheme, Jaipur Cafe, Continental, Fast Food 1.06
214 1 Fat Lulu's 26.899642 75.794617 1300.0 3.0 4.3 Plot 9, Bhawani Singh Lane, Sahakar Marg, C Sc... Continental, Italian, Burger, Pizza, Beverages 1.59
216 1 Surya Mahal Restaurant 26.916365 75.811299 1000.0 3.0 4.1 Mirza Ismail Road, Near Panch Batti, MI Road, ... North Indian, Fast Food, Chinese, South Indian 2.42
222 1 OTB - On The Bar B-Q 26.856151 75.806774 1200.0 3.0 4.2 6th Floor, Crystal Court Mall, Malviya Nagar, ... Italian, Chinese, North Indian, Fast Food, Bev... 6.53
224 1 Barbeque Nation 26.916452 75.809869 1400.0 3.0 4.8 1st Floor, E2 Khandelwal Mansion, Paanch Batti... North Indian, Continental 2.29
230 1 Ten Twisters 26.914034 75.805669 1800.0 3.0 3.8 4th Floor, The Landmark, Ahinsa Circle, C Sche... North Indian, Continental, Chinese, Asian 1.83
243 1 Caffe Palladio Jaipur 26.899728 75.815982 2000.0 4.0 3.6 100, Near Trimurti Circle, J.LN. Marg, Santha ... Italian, Turkish, Lebanese 3.18
264 1 Jaipur Modern Kitchen 26.913973 75.798844 1600.0 3.0 4.0 51, Sardar Patel Marg, Dhuleshwar Garden Cross... Italian, Mediterranean 1.16
268 1 Monarch Restaurant - Holiday Inn Jaipur City C... 26.902867 75.793023 1900.0 3.0 3.8 Holiday Inn Jaipur City Centre, Commercial Plo... North Indian, Chinese, Continental, Rajasthani 1.20
269 1 Chao Chinese Bistro - Holiday Inn Jaipur City ... 26.902858 75.793011 1500.0 3.0 4.1 Holiday Inn Jaipur City Centre, Commercial Plo... Chinese, Asian, Thai 1.20
272 1 Jaipur Jungle 26.899894 75.834296 1300.0 3.0 3.5 6th Floor, UDB Tower, Baraf Khana, Adarsh Naga... North Indian, Chinese, Italian 4.87
335 1 Kebabs & Curries Company 26.898832 75.738786 1000.0 3.0 4.1 6/33, Chitrakoot Marg, Near Chitrakoot Stadium... North Indian, Kebab 5.05
416 1 Bazaar - Zone by the Park 26.933081 75.793962 1600.0 3.0 3.8 Zone by the Park, D 65A, Madho Singh Road, Sin... North Indian, Chinese, Continental, Rajasthani... 2.39
420 1 Playa - Zone By The Park 26.933090 75.793942 1700.0 3.0 3.0 Zone By The Park, D65A, Madho Singh Road, Sind... Chinese, North Indian, Mediterranean 2.39
427 1 Inchin 26.929324 75.785963 1500.0 3.0 4.0 D 253 A, Near Sahpura Guest House, Devi Marg, ... Chinese, Thai, Momos 1.88
431 1 Republic of Noodles - Lemon Tree Premier 26.935143 75.791984 1400.0 3.0 4.2 Lemon Tree Premier, City Plaza, Nirwan Marg, B... Chinese, Thai 2.56
454 1 Surabhi Restaurant & Turban Museum 26.931962 75.831670 1000.0 3.0 3.7 Behind Subhash Chowk Petrol Pump, Old Amer Roa... Rajasthani, Chinese, Continental 4.91
475 1 Around The World - Ramada Hotel 26.895812 75.828931 1500.0 3.0 3.7 Ramada Hotel, Avenue 1, Govind Marg, Raja Park... North Indian, Continental, Italian, Asian 4.53
In [37]:
cluster_2=clustered_df[clustered_df['cluster_labels']==2]
print('Mean distance of a distance from central location of cluster 2: ',clustered_df[clustered_df['cluster_labels']==2]['distance'].mean())
print('Mean rating of cluster 2: ',clustered_df[clustered_df['cluster_labels']==2]['rating'].mean())
print('Mean price rate for an individual of cluster 2: ',(clustered_df[clustered_df['cluster_labels']==2]['price_for_two']/2).mean())
print('There are {} restaurants in cluster 2 '.format(clustered_df[clustered_df['cluster_labels']==2]['rating'].shape[0]))
print('{} % of restaurants are in cluster 2 '.format(round((cluster_2.shape[0]/clustered_df.shape[0])*100,2)))
Mean distance of a distance from central location of cluster 2:  3.5512499999999996
Mean rating of cluster 2:  3.875
Mean price rate for an individual of cluster 2:  2381.25
There are 8 restaurants in cluster 2 
2.89 % of restaurants are in cluster 2 
In [38]:
cui=cluster_2['cuisines'].value_counts().sort_index()
color=cm.rainbow((np.linspace(0,1,12)))
plt.figure(figsize = (30, 12))
plt.bar(cui.index,cui.values,color=color)
plt.xticks(rotation='vertical',fontsize=20)
plt.xlabel("cuisines", fontsize = 25)
plt.ylabel("Count", fontsize = 25)
plt.title("Count of venues with given cuisines", fontsize = 30)
Out[38]:
Text(0.5, 1.0, 'Count of venues with given cuisines')
In [39]:
cluster_2
Out[39]:
cluster_labels venue latitude longitude price_for_two price_range rating address cuisines distance
41 2 Suvarna Mahal - Rambagh Palace 26.898109 75.808150 5000.0 4.0 4.3 Rambagh Palace, Bhawani Singh Road, C Scheme, ... North Indian, Awadhi, Hyderabadi 2.61
42 2 The Rajput Room - Rambagh Palace 26.898109 75.808150 4000.0 4.0 4.2 Rambagh Palace, Bhawani Singh Road, C Scheme, ... North Indian, Continental, Asian 2.61
43 2 The Verandah - Rambagh Palace 26.898109 75.808150 4000.0 4.0 4.1 Rambagh Palace, Bhawani Singh Road, C Scheme, ... North Indian, Continental 2.61
44 2 The Polo Bar - Rambagh Palace 26.898109 75.808150 4100.0 4.0 4.0 Rambagh Palace, Bhawani Singh Road, C Scheme, ... Finger Food 2.61
365 2 Sheesh Mahal Bar - ITC Rajputana Hotel 26.918842 75.791834 4000.0 4.0 3.8 ITC Rajputana Hotel, Palace Road, Gopalbari, J... Finger Food 0.84
368 2 Sheesh Mahal-Virasat Heritage Restaurant 26.899535 75.793017 6000.0 4.0 2.9 Virasat Heritage Restaurant, Plot B, Sahkar Ma... Rajasthani 1.53
369 2 Swapna Mahal - The Raj Palace 26.935661 75.834233 6000.0 4.0 3.8 The Raj Palace, Jorawar Singh Gate, Amer Road,... North Indian, Rajasthani, Continental, Chinese 5.33
370 2 Surya Mahal Courtyard - The Oberoi Rajvilas 26.876279 75.882480 5000.0 4.0 3.9 The Oberoi Rajvilas, Goner Road, Near Agra Roa... North Indian, Continental, Chinese 10.27
In [40]:
cluster_3=clustered_df[clustered_df['cluster_labels']==3]
print('Mean distance of a distance from central location of cluster 3 ',clustered_df[clustered_df['cluster_labels']==3]['distance'].mean())
print('Mean rating of cluster 3: ',clustered_df[clustered_df['cluster_labels']==3]['rating'].mean())
print('Mean price rate for an individual of cluster 3: ',(clustered_df[clustered_df['cluster_labels']==3]['price_for_two']/2).mean())
print('There are {} restaurants in cluster  '.format(clustered_df[clustered_df['cluster_labels']==3]['rating'].shape[0]))
print('{} % of restaurants are in cluster 3 '.format(round((cluster_3.shape[0]/clustered_df.shape[0])*100,2)))
Mean distance of a distance from central location of cluster 3  3.368461538461539
Mean rating of cluster 3:  4.084615384615383
Mean price rate for an individual of cluster 3:  1357.6923076923076
There are 13 restaurants in cluster  
4.69 % of restaurants are in cluster 3 
In [41]:
cui=cluster_3['cuisines'].value_counts().sort_index()
color=cm.rainbow((np.linspace(0,1,12)))
plt.figure(figsize = (30, 12))
plt.bar(cui.index,cui.values,color=color)
plt.xticks(rotation='vertical',fontsize=20)
plt.xlabel("cuisines", fontsize = 25)
plt.ylabel("Count", fontsize = 25)
plt.title("Count of venues with given cuisines", fontsize = 30)
Out[41]:
Text(0.5, 1.0, 'Count of venues with given cuisines')
In [42]:
cluster_3
Out[42]:
cluster_labels venue latitude longitude price_for_two price_range rating address cuisines distance
40 3 Steam - Rambagh Palace 26.898109 75.808150 2800.0 4.0 4.8 Rambagh Palace, Bhawani Singh Road, C Scheme, ... Italian, Lebanese 2.61
46 3 Peshawri - ITC Rajputana Hotel 26.918853 75.791835 3000.0 4.0 4.6 ITC Rajputana Hotel, Palace Road, Gopalbari, J... North Indian, Rajasthani, Mughlai, Desserts 0.85
47 3 Jal Mahal - ITC Rajputana Hotel 26.918855 75.791823 3500.0 4.0 4.2 ITC Rajputana Hotel, Palace Road, Gopalbari, J... North Indian, Chinese, Continental 0.84
49 3 Blackout Club & Terrace 26.914006 75.805721 2200.0 4.0 4.2 Hotel Golden Oak, 9th Floor, Ahinsa Circle, La... North Indian, Italian, Continental, Finger Food 1.84
58 3 Baradari - City Palace 26.926636 75.824898 2200.0 4.0 3.9 The City Palace, Gate 2, Jaleb Chowk, Pink Cit... Italian, Continental, Rajasthani, North Indian 4.05
151 3 1135 AD 26.986758 75.850630 2500.0 4.0 4.1 Level 2, Jaleb Chowk, Near Sheela Mata Temple,... North Indian, Mughlai, Rajasthani 10.36
166 3 Little Italy 26.910798 75.798409 2400.0 4.0 4.2 C 11, KK Square, C Scheme, Jaipur Italian, Mexican, Beverages 1.12
215 3 Niros 26.916332 75.811452 2200.0 4.0 4.1 319, Panch Batti, MI Road, Jaipur North Indian, Chinese, Continental, Mughlai 2.44
273 3 Chaandi - Hilton Jaipur 26.901296 75.783818 3000.0 4.0 4.3 Hilton Jaipur, 42, Geejgarh House, Hawa Sadak,... North Indian, Mughlai, Rajasthani 1.28
274 3 Aurum - Hilton Jaipur 26.901297 75.783793 3000.0 4.0 3.8 Hilton Jaipur, 42, Geejgarh House, Hawa Sadak,... North Indian, Italian, Asian 1.28
280 3 Jal Mahal- Trident Jaipur 26.956786 75.843221 2500.0 4.0 3.9 Trident Jaipur, Opposite Jal Mahal, Amer Road,... North Indian, Continental 7.42
282 3 24/7 Restaurant- The LaLiT Jaipur 26.840935 75.807506 3000.0 4.0 4.0 The LaLiT Jaipur, Jagatpura Road, Malviya Naga... North Indian, Continental, Asian, Italian 8.17
366 3 Swarn Mahal-Virasat Heritage Restaurant 26.899544 75.793017 3000.0 4.0 3.0 Virasat Heritage Restaurant, Plot B, Sahkar Ma... Rajasthani 1.53
In [43]:
cluster_0=clustered_df[clustered_df['cluster_labels']==0]
cluster_0.head()
Out[43]:
cluster_labels venue latitude longitude price_for_two price_range rating address cuisines distance
0 0 Tapri Central 26.891384 75.803603 800.0 2.0 4.6 B4 E, 3rd Floor, Surana Jewellers, Opposite Ce... Cafe, Fast Food, Street Food 2.84
1 0 Tapri Pratham 26.891401 75.803677 800.0 2.0 4.4 43, Everest Colony, Near Punjab National Bank ... Cafe, Fast Food, Street Food, Beverages 2.84
2 0 Tapri Ashram 26.841188 75.796064 800.0 2.0 4.4 Shopping Arcade, Jaipur Marriott Hotel, Ashram... Cafe, Fast Food, Street Food, Beverages 7.94
3 0 The Yellow House - The Robot Restaurant 26.915263 75.809704 700.0 2.0 3.6 Silver Square Mall, Near Rajmandir Cinema, C S... North Indian, Chinese, Italian, Mexican 2.25
4 0 Tea Tradition 26.911357 75.802407 450.0 1.0 3.8 D 29-A, Chandra Niwas, Subhash Marg, C Scheme,... Cafe, Fast Food 1.51
In [44]:
for lat,long,name,distance,rating in zip(cluster_0['latitude'],cluster_0['longitude'],cluster_0['venue'],cluster_0['distance'],cluster_0['rating']):
    label = '{} , \n distance from the center {} km ,rating: {}'.format(name,distance,rating)
    label = folium.Popup(label, parse_html=True)
    folium.CircleMarker(
     [lat, long],
        radius=5,
        popup=label,
        color='green',
        fill=True,
        fill_color='#3144aa',
        fill_opacity=0.7,
        parse_html=True).add_to(jaipur_map)
jaipur_map
Out[44]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [45]:
cluster_1=clustered_df[clustered_df['cluster_labels']==1]
cluster_1.head()
Out[45]:
cluster_labels venue latitude longitude price_for_two price_range rating address cuisines distance
7 1 On The House 26.905337 75.794570 1500.0 3.0 4.4 E 145, Ramesh Marg, Behind Talwalkars, C Schem... Italian, Continental, Mexican, Cafe 1.06
9 1 Corner House 26.907390 75.795520 1200.0 3.0 4.0 F 31, Azad Marg, Ashok Nagar, C Scheme, Jaipur North Indian, Chinese, Italian, Beverages, Ice... 0.99
21 1 Thali and More 26.910818 75.805427 1100.0 3.0 4.5 C-46 B, Sarojini Marg, Above Punjab National B... North Indian, South Indian, Chinese, Fast Food 1.81
29 1 Laxmi Mishthan Bhandar 26.896717 75.815396 1000.0 3.0 3.3 A/65, JLN Marg, Near Soni Hospital, Raja Park,... North Indian, Mithai, Rajasthani, South Indian... 3.29
48 1 La Palma Cafe and Lounge Bar 26.914026 75.804732 1400.0 3.0 3.9 The Hotel Garden View, Subhash Marg, Near Ahin... Italian, European, Continental 1.74
In [46]:
for lat,long,name,distance,rating in zip(cluster_1['latitude'],cluster_1['longitude'],cluster_1['venue'],cluster_1['distance'],cluster_0['rating']):
    label = '{} , \n distance from the center {} km ,rating: {}'.format(name,distance,rating)
    label = folium.Popup(label, parse_html=True)
    folium.CircleMarker(
     [lat, long],
        radius=5,
        popup=label,
        color='green',
        fill=True,
        fill_color='#3144aa',
        fill_opacity=0.7,
        parse_html=True).add_to(jaipur_map)
jaipur_map
Out[46]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [47]:
cluster_2=clustered_df[clustered_df['cluster_labels']==2]
cluster_2.head()
Out[47]:
cluster_labels venue latitude longitude price_for_two price_range rating address cuisines distance
41 2 Suvarna Mahal - Rambagh Palace 26.898109 75.808150 5000.0 4.0 4.3 Rambagh Palace, Bhawani Singh Road, C Scheme, ... North Indian, Awadhi, Hyderabadi 2.61
42 2 The Rajput Room - Rambagh Palace 26.898109 75.808150 4000.0 4.0 4.2 Rambagh Palace, Bhawani Singh Road, C Scheme, ... North Indian, Continental, Asian 2.61
43 2 The Verandah - Rambagh Palace 26.898109 75.808150 4000.0 4.0 4.1 Rambagh Palace, Bhawani Singh Road, C Scheme, ... North Indian, Continental 2.61
44 2 The Polo Bar - Rambagh Palace 26.898109 75.808150 4100.0 4.0 4.0 Rambagh Palace, Bhawani Singh Road, C Scheme, ... Finger Food 2.61
365 2 Sheesh Mahal Bar - ITC Rajputana Hotel 26.918842 75.791834 4000.0 4.0 3.8 ITC Rajputana Hotel, Palace Road, Gopalbari, J... Finger Food 0.84
In [48]:
for lat,long,name,distance,rating in zip(cluster_2['latitude'],cluster_2['longitude'],cluster_2['venue'],cluster_2['distance'],cluster_0['rating']):
    label = '{} , \n distance from the center {} km ,rating: {}'.format(name,distance,rating)
    label = folium.Popup(label, parse_html=True)
    folium.CircleMarker(
     [lat, long],
        radius=5,
        popup=label,
        color='black',
        fill=True,
        fill_color='#8186aa',
        fill_opacity=0.7,
        parse_html=True).add_to(jaipur_map)
jaipur_map
Out[48]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [49]:
cluster_3=clustered_df[clustered_df['cluster_labels']==3]
cluster_3.head()
Out[49]:
cluster_labels venue latitude longitude price_for_two price_range rating address cuisines distance
40 3 Steam - Rambagh Palace 26.898109 75.808150 2800.0 4.0 4.8 Rambagh Palace, Bhawani Singh Road, C Scheme, ... Italian, Lebanese 2.61
46 3 Peshawri - ITC Rajputana Hotel 26.918853 75.791835 3000.0 4.0 4.6 ITC Rajputana Hotel, Palace Road, Gopalbari, J... North Indian, Rajasthani, Mughlai, Desserts 0.85
47 3 Jal Mahal - ITC Rajputana Hotel 26.918855 75.791823 3500.0 4.0 4.2 ITC Rajputana Hotel, Palace Road, Gopalbari, J... North Indian, Chinese, Continental 0.84
49 3 Blackout Club & Terrace 26.914006 75.805721 2200.0 4.0 4.2 Hotel Golden Oak, 9th Floor, Ahinsa Circle, La... North Indian, Italian, Continental, Finger Food 1.84
58 3 Baradari - City Palace 26.926636 75.824898 2200.0 4.0 3.9 The City Palace, Gate 2, Jaleb Chowk, Pink Cit... Italian, Continental, Rajasthani, North Indian 4.05
In [50]:
for lat,long,name,distance,rating in zip(cluster_3['latitude'],cluster_3['longitude'],cluster_3['venue'],cluster_3['distance'],cluster_3['rating']):
    label = '{} , \n distance from the center {} km ,rating: {}'.format(name,distance,rating)
    label = folium.Popup(label, parse_html=True)
    folium.CircleMarker(
     [lat, long],
        radius=5,
        popup=label,
        color='orange',
        fill=True,
        fill_color='#3468aa',
        fill_opacity=0.7,
        parse_html=True).add_to(jaipur_map)
jaipur_map
Out[50]:
Make this Notebook Trusted to load map: File -> Trust Notebook

Results and Discussion

Based on the analysis we can draw many conclusions.We have profiled the clusters based on the price_Range,rating,average price for two and distance from the center.

From cluster 0

  • Mean distance of a distance from central location of cluster 0: 3.719904306220096
  • Mean rating of cluster 0: 3.817224880382775
  • Mean price rate for an individual of cluster 0: 226.79425837320574
  • There are 209 restaurants in cluster 0
  • 75.45 % of restaurants are in cluster 0

From cluster 1,

  • Mean distance of a distance from central location of cluster 1: 2.469787234042553
  • Mean rating of cluster 1: 3.8999999999999995
  • Mean price rate for an individual of cluster 1: 702.6595744680851
  • There are 47 restaurants in cluster 1
  • 16.97 % of restaurants are in cluster 1

From cluster 2,

  • Mean distance of a distance from central location of cluster 2: 3.5512499999999996
  • Mean rating of cluster 2: 3.875
  • Mean price rate for an individual of cluster 2: 2381.25
  • There are 8 restaurants in cluster 2
  • 2.89 % of restaurants are in cluster 2

From cluster 3,

  • Mean distance of a distance from central location of cluster 3 3.368461538461539
  • Mean rating of cluster 3: 4.084615384615383
  • Mean price rate for an individual of cluster 3: 1357.6923076923076
  • There are 13 restaurants in cluster
  • 4.69 % of restaurants are in cluster 3

As per analysis , we can suggest that cluster 0 and cluster 1 is budgeted restaurants for medium class with rating ranging to 4, which can be considered for dinning for tourists and for any person want to visit restaurants in Jaipur. Also for any business person looking to open restaurants in this location. It can be suggested as good option.

Cluster 3 is little expensive compare to cluster 0 and 1 with same rating coming as 4.

Cluster 2 is very expensive with rating 3.8.

On the basis of data analysis for restaurants in Jaipur ,anyone can use this information to build up an on line website/mobile application, to provide users with up to date information about various venues in the city based on the search criteria (name, rating and price).

Conclusion

The purpose of this project was to explore the places that a person visiting Jaipur could visit. The venues have been identified using Foursquare and Zomato API and have been plotted on the map

In [ ]: